home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / keyb / cedwars2.zip / CED.ART < prev    next >
Text File  |  1987-11-15  |  17KB  |  387 lines

  1. Living With DOS:  CED, the Command Editor
  2. by Barry Simon
  3.  
  4. Copyright (c) 1986, Capital PC User Group Inc.
  5. This material may be republished only for internal use
  6. by other not-for-profit user groups.
  7.  
  8. Posted on Compuserve with permission of CPCUG.  May not be
  9. reproduced without including the above copyright notice.
  10.  
  11. Published in the January 1986 issue of the Capital PC Monitor.
  12.  
  13.  
  14. This article is the second in a series that discusses products
  15. and utilities that enhance the usefulness and ease of use of
  16. DOS, the Disk Operating System.  This article discusses a
  17. program called CED (for Command EDitor) by Chris Dunford.  CED
  18. remains loaded in  memory and available while you are in DOS and
  19. in some additional programs like EDLIN and DEBUG; it sits
  20. between the commands you type in and DOS.
  21.  
  22. CED is the kind of program that you can't do without once you
  23. start using it.  Indeed, if I were travelling somewhere and were
  24. told that I'd have a PC with only the basic application
  25. software, the first utility I would be sure to bring along would
  26. be CED.
  27.  
  28. CED was originally placed in the public domain by its author.
  29. An enhanced version, PROFESSIONAL CED, was recently introduced
  30. as a commercial product.  This review discusses the public
  31. domain version of CED, version 1.0D; some of the enhanced
  32. features of the commercial version will be described in a
  33. separate article that will appear in a future issue of the
  34. MONITOR.
  35.  
  36.  
  37. OVERVIEW
  38.  
  39. CED provides four major facilities:
  40.  
  41.   1.  command editing
  42.   2.  a command stack or buffer
  43.   3.  recalling a program with the same parameters
  44.   4.  synonyms
  45.  
  46. Imagine exiting your word processor after working on a letter or
  47. document.  You enter a command in DOS, perhaps copying a file to
  48. the directory where you have your spelling checker, a directory
  49. with a long path name.  Before hitting <enter>, you scan the
  50. command and discover a typing error in the middle.
  51. Unfortunately, DOS does not have a full-function command editor
  52. so you cannot go back and edit the command as you can with a
  53. word processor; instead, you have to retype the correct command.
  54. CED resolves this problem by providing a command editing
  55. capability for DOS.
  56.  
  57. And, having learned to use the DOS editing keys (F1, F3) to
  58. avoid having to retype the last command, haven't you wished that
  59. you had the capability to recall the command that was made the
  60. one before the last one or even six commands ago?  That's what
  61. the command stack is all about.
  62.  
  63. And having used your word processing program to edit a file
  64. "therise.and", haven't you wished that you could call up the
  65. program on this last used file without having to remember the
  66. precise file name.  That's what parameter recall is all about.
  67.  
  68. And aren't there some long commands that you're tired of typing
  69. and you wish you could abbreviate them or use shorthand
  70. notations for them?  That's what the synonyms are all about --
  71. creating macros as shorthand methods for issuing a set of
  72. commands.
  73.  
  74.  
  75. The Command Line Editor
  76.  
  77. The command editor provides most of the features that you would
  78. want and expect in editing the current line.  You can move the
  79. cursor non-destructively with the <left-> and <right-arrow> keys
  80. and use the <delete> key to delete the character at the cursor.
  81. In the default mode, striking a key overwrites the character at
  82. the cursor, i.e., replaces the character at the cursor with the
  83. character that was struck.  The <insert> key toggles between
  84. this mode and an insert mode where the key struck is inserted
  85. just before the cursor.  The <home> and <end> keys take the
  86. cursor to the beginning and end of the line respectively.
  87. <Ctrl-End> erases from the cursor to the end of the line; <Ctrl-
  88. left-> and <Ctrl-right-arrow> move the cursor a word at a time.
  89.  
  90. The editing keys are helpful in normal use but are especially
  91. useful because you can recall previous commands from a stack and
  92. edit them.  For example, PC-WRITE has an editing program called
  93. ed.exe and a printing program called pr.exe.  After exiting the
  94. editor which you called up with ed FILENAME, you need only
  95. recall this command from the stack, hit <home>, then "pr" and
  96. finally <enter> to issue the command pr FILENAME.
  97.  
  98.  
  99. The Command Stack
  100.  
  101. The <left-> and <right-arrow> keys move the cursor in the
  102. obvious manner.  It would be useful to have full-screen editing
  103. in DOS so that one could use the up and down cursor to move
  104. around the screen reissuing commands.  In many ways, the command
  105. stack does precisely that; however, it also allows you to use
  106. commands that have scrolled off the screen!
  107.  
  108. When CED is invoked, it reserves 2K of memory (this number can
  109. be modified) to store the last 2,000 characters sent as commands
  110. to DOS.  After issuing a new command, the <up-arrow> key
  111. restores that command to the command line.  If you just <enter>
  112. without any editing of the command line, you move one position
  113. down in the stack; that is, the <up-arrow> key recalls the
  114. command just issued and the <down-arrow> key recalls the next
  115. command in the stack.  This is especially convenient for
  116. recycling a series of commands.
  117.  
  118. If you should change your mind while you're in the stack, you
  119. can press the <esc> key to blank the command line.
  120.  
  121. The stack idea is enhanced with many thoughtful extras which are
  122. typical of the CED program.  One is the "ignore character".  The
  123. ignore character tells CED not to include in the stack the
  124. command that follows.  The default value for the ignore
  125. character is <Ctrl-N> or ^N (* in PROFESSIONAL CED) but that can
  126. be changed by the user.  If, for example, you enter "dir" at the
  127. command line, the command is added to the stack.  However, by
  128. entering "^Ndir", the command is issued to DOS but is not placed
  129. in the stack.
  130.  
  131. This is especially useful for key redefinitions.  I have defined
  132. <F1> to mean "dir^" (where ^ means <enter>).  Because I can get
  133. that command by hitting <F1>, there is no reason to stack it, so
  134. <F1> is really defined to CED as "^Ndir^".  In general, you
  135. should only do this with redefinitions that end in <enter>.  For
  136. example, my <Alt-F1> key means "dir[]" where [] means space.
  137. Since I would want to recall a command such as "dir
  138. C:\bin\dump\vdump\ce*.*", I do not put a ^N before that dir.
  139.  
  140. Another use for the ignore character is to stack synonyms.  As
  141. I'll explain shortly, you can set up lists of short names for
  142. commands or sets of commands that you use often.  If there are
  143. sets of commands, both the synonym and the individual commands
  144. get stacked; depending upon the size of your commands, this
  145. could fill up the stack.  Thus, you would want to include the
  146. ignore character before the individual commands in your synonym
  147. definitions.  [This is not necessary in PROFESSIONAL CED because
  148. the commands within synonyms are NOT stacked.]  WARNING: Because
  149. of the way CED processes the ignore character, you should not
  150. include it in front of the first command in a multiple command
  151. synonym nor in front of a command which is a synonym if you have
  152. nested synonyms.
  153.  
  154.  
  155. Parameter Recall
  156.  
  157. One can tell CED that one wishes to have certain programs
  158. normally called up with the same parameters that were used the
  159. last time the program was loaded during the current seesion.
  160. Thus, if your word processor is called ed.exe and you issue the
  161. command
  162.  
  163.   ced pcall ed
  164.  
  165. then this feature is made available for the command "ed".  If
  166. you enter the command "ed oldfile newfile", CED stores the
  167. "oldfile newfile".  The next time you type "ed" followed by
  168. <Enter>, CED will resupply these parameters by flashing them on
  169. the screen and passing them to the ed-program.  If you want to
  170. apply ed to another file, typing "ed newerfile" does precisely
  171. what you want and stores "newerfile" in the pcall buffer.  If
  172. you want to invoke ed without any parameters, typing "ed " (note
  173. the space) followed by <Enter> will work.  The pcalled command
  174. can be a CED synonym.
  175.  
  176.  
  177. Loading CED and Issuing Commands to It
  178.  
  179. The final feature of CED is its "synonyms".  Before explaining
  180. this, it is first necessary to explain how you issue commands to
  181. CED.  There are two w